/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Operations.Bit;

import Operations.Operation;
import java.awt.image.BufferedImage;

/**
 *
 * @author littlechild
 */
public class OpContrastStretch implements Operation{

    public BufferedImage operate(BufferedImage image, double[] paras) {
        BufferedImage returnImage=new BufferedImage(image.getWidth(),image.getHeight(),image.getType());
        for(int i=0;i!=image.getWidth();++i) {
            for (int j=0;j!=image.getHeight();++j) {
                int rgb=image.getRGB(i, j);
                int red=(rgb>>>16)&0xff;
                int green=(rgb>>>8)&0xff;
                int blue=rgb&0xff;
                returnImage.setRGB(i, j, ((0xff-red)<<16)|((0xff-green)<<8)|(0xff-blue));
            }
        }
        return returnImage;
    }

}
